home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / CodeFragments.a < prev    next >
Text File  |  1996-05-01  |  22KB  |  689 lines

  1. ;
  2. ;    File:        CodeFragments.a
  3. ;
  4. ;    Contains:    Public Code Fragment Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7 and System 8
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18. ;
  19. ; *
  20. ; ===========================================================================================
  21. ; The Code Fragment Manager API
  22. ; =============================
  23. ;
  24.     IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
  25. __CODEFRAGMENTS__ SET 1
  26.  
  27.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  28.     include 'Types.a'
  29.     ENDIF
  30.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  31.     include 'Files.a'
  32.     ENDIF
  33.     IF FOR_SYSTEM8_PREEMPTIVE THEN
  34.     IF &TYPE('__KERNEL__') = 'UNDEFINED' THEN
  35.     include 'Kernel.a'
  36.     ENDIF
  37.     IF &TYPE('__FILEMANAGERTYPES__') = 'UNDEFINED' THEN
  38.     include 'FileManagerTypes.a'
  39.     ENDIF
  40.     IF &TYPE('__TEXTOBJECTS__') = 'UNDEFINED' THEN
  41.     include 'TextObjects.a'
  42.     ENDIF
  43.     ENDIF
  44. ;
  45. ; ß
  46. ; ===========================================================================================
  47. ; Universal types and constants
  48. ; =============================
  49. ;
  50.     IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
  51. ;
  52. ; ----------------------------------------------------------------------------
  53. ; These declarations are for System 7 and all System 8 execution environments.
  54. ;
  55.  
  56. kCFragResourceType                EQU        'cfrg'
  57. kCFragResourceID                EQU        0
  58. kCFragLibraryFileType            EQU        'shlb'
  59. kCFragAllFileTypes                EQU        $FFFFFFFF
  60. ; typedef OSType                         CFragArchitecture
  61.  
  62.  
  63. kPowerPCCFragArch                EQU        'pwpc'
  64. kMotorola68KCFragArch            EQU        'm68k'
  65. kAnyCFragArch                    EQU        $3F3F3F3F
  66.     IF GENERATINGPOWERPC THEN
  67.  
  68. kCompiledCFragArch                EQU        'pwpc'
  69.     ENDIF
  70.     IF GENERATING68K THEN
  71.  
  72. kCompiledCFragArch                EQU        'm68k'
  73.     ENDIF
  74. ; typedef UInt32                         CFragVersionNumber
  75.  
  76.  
  77. kNullCFragVersion                EQU        0
  78. kWildcardCFragVersion            EQU        $FFFFFFFF
  79. ; typedef UInt8                         CFragUsage
  80.  
  81.  
  82. kImportLibraryCFrag                EQU        0                    ; Standard CFM import library.
  83. kApplicationCFrag                EQU        1                    ; Macintosh application.
  84. kDropInAdditionCFrag            EQU        2                    ; Private extension to an application or library.
  85.  
  86. kIsCompleteCFrag                EQU        0                    ; A "base" fragment, not an update.
  87. kFirstCFragUpdate                EQU        1                    ; The first update, others are numbered 2, 3, ...
  88.  
  89. kCFragGoesToEOF                    EQU        0
  90. ; typedef UInt8                         CFragLocatorKind
  91.  
  92.  
  93. kMemoryCFragLocator                EQU        0                    ; Container is already addressable.
  94. kDataForkCFragLocator            EQU        1                    ; Container is in a file's data fork.
  95. kResourceCFragLocator            EQU        2                    ; Container is in a file's resource fork.
  96. ;
  97. ; --------------------------------------------------------------------------------------
  98. ; A 'cfrg' resource consists of a header followed by a sequence of variable length
  99. ; members.  The constant kDefaultCFragNameLen only provides for a legal ANSI declaration
  100. ; and for a reasonable display in a debugger.  The actual name field is cut to fit.
  101. ; There may be "extensions" after the name, the memberSize field includes them.  The
  102. ; general form of an extension is a 16 bit type code followed by a 16 bit size in bytes.
  103. ; Only one standard extension type is defined at present, it is used by SOM's searching
  104. ; mechanism.
  105. ;
  106. CFragUsage1Union        RECORD 0
  107. ;  ! Meaning differs depending on value of "usage".
  108. appStackSize             ds.l    1                ; offset: $0 (0)        ;  If the fragment is an application. (Not used by CFM!)
  109. sizeof                     EQU *                    ; size:   $4 (4)
  110.                         ENDR
  111. CFragUsage2Union        RECORD 0
  112. ;  ! Meaning differs depending on value of "usage".
  113. appSubdirID                 ds.w    1                ; offset: $0 (0)        ;  If the fragment is an application.
  114. sizeof                     EQU *                    ; size:   $2 (2)
  115.                         ENDR
  116. CFragWhere1Union        RECORD 0
  117. ;  ! Meaning differs depending on value of "where".
  118. spaceID                     ds.l    1                ; offset: $0 (0)        ;  If the fragment is in memory.  (Actually an AddressSpaceID.)
  119.                          ORG 0
  120. forkKind                 ds.l    1                ; offset: $0 (0)        ;  If the fragment is in an arbitrary byte stream fork.
  121. sizeof                     EQU *                    ; size:   $4 (4)
  122.                         ENDR
  123. CFragWhere2Union        RECORD 0
  124. ;  ! Meaning differs depending on value of "where".
  125. forkInstance             ds.w    1                ; offset: $0 (0)        ;  If the fragment is in an arbitrary byte stream fork.
  126. sizeof                     EQU *                    ; size:   $2 (2)
  127.                         ENDR
  128.  
  129. kDefaultCFragNameLen            EQU        16
  130. CFragResourceMember        RECORD 0
  131. architecture             ds.l    1                ; offset: $0 (0)
  132. reservedA                 ds.w    1                ; offset: $4 (4)        ;  ! Must be zero!
  133. reservedB                 ds.b    1                ; offset: $6 (6)        ;  ! Must be zero!
  134. updateLevel                 ds.b    1                ; offset: $7 (7)
  135. currentVersion             ds.l    1                ; offset: $8 (8)
  136. oldDefVersion             ds.l    1                ; offset: $C (12)
  137. uUsage1                     ds        CFragUsage1Union ; offset: $10 (16)
  138. uUsage2                     ds        CFragUsage2Union ; offset: $14 (20)
  139. usage                     ds.b    1                ; offset: $16 (22)
  140. where                     ds.b    1                ; offset: $17 (23)
  141. offset                     ds.l    1                ; offset: $18 (24)
  142. length                     ds.l    1                ; offset: $1C (28)
  143. uWhere1                     ds        CFragWhere1Union ; offset: $20 (32)
  144. uWhere2                     ds        CFragWhere2Union ; offset: $24 (36)
  145. extensionCount             ds.w    1                ; offset: $26 (38)        ;  The number of extensions beyond the name.
  146. memberSize                 ds.w    1                ; offset: $28 (40)        ;  Size in bytes, includes all extensions.
  147. name                     ds.b    16                ; offset: $2A (42)        ;  ! Actually a sized PString.
  148. sizeof                     EQU *                    ; size:   $3A (58)
  149.                         ENDR
  150. ; typedef struct CFragResourceMember *    CFragResourceMemberPtr
  151.  
  152. CFragResourceExtensionHeader RECORD 0
  153. extensionKind             ds.w    1                ; offset: $0 (0)
  154. extensionSize             ds.w    1                ; offset: $2 (2)
  155. sizeof                     EQU *                    ; size:   $4 (4)
  156.                         ENDR
  157. ; typedef struct CFragResourceExtensionHeader * CFragResourceExtensionHeaderPtr
  158.  
  159. CFragResourceSearchExtension RECORD 0
  160. header                     ds        CFragResourceExtensionHeader ; offset: $0 (0)
  161. libKind                     ds.l    1                ; offset: $4 (4)
  162. qualifiers                 ds.b    1                ; offset: $8 (8) <-- really an array of length one ;  ! Actually four PStrings.
  163.                          ORG 10
  164. sizeof                     EQU *                    ; size:   $A (10)
  165.                         ENDR
  166. ; typedef struct CFragResourceSearchExtension * CFragResourceSearchExtensionPtr
  167.  
  168.  
  169. kCFragResourceSearchExtensionKind EQU    $30EE
  170. CFragResource            RECORD 0
  171. reservedA                 ds.l    1                ; offset: $0 (0)        ;  ! Must be zero!
  172. reservedB                 ds.l    1                ; offset: $4 (4)        ;  ! Must be zero!
  173. reservedC                 ds.w    1                ; offset: $8 (8)        ;  ! Must be zero!
  174. version                     ds.w    1                ; offset: $A (10)
  175. reservedD                 ds.l    1                ; offset: $C (12)        ;  ! Must be zero!
  176. reservedE                 ds.l    1                ; offset: $10 (16)        ;  ! Must be zero!
  177. reservedF                 ds.l    1                ; offset: $14 (20)        ;  ! Must be zero!
  178. reservedG                 ds.l    1                ; offset: $18 (24)        ;  ! Must be zero!
  179. reservedH                 ds.w    1                ; offset: $1C (28)        ;  ! Must be zero!
  180. memberCount                 ds.w    1                ; offset: $1E (30)
  181. firstMember                 ds        CFragResourceMember ; offset: $20 (32)
  182. sizeof                     EQU *                    ; size:   $5A (90)
  183.                         ENDR
  184. ; typedef struct CFragResource *        CFragResourcePtr
  185.  
  186.  
  187. kCurrCFragResourceVersion        EQU        1
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196. ; typedef UInt32                         CFragLoadOptions
  197.  
  198.  
  199. kLoadCFrag                        EQU        $0001                ; Try to use existing copy, load if not found.
  200. kFindCFrag                        EQU        $0002                ; Try find an existing copy, don't load if not found.
  201. kPrivateCFragCopy                EQU        $0005                ; Load a new private copy.
  202.  
  203. kUnresolvedCFragSymbolAddress    EQU        0
  204. ; typedef UInt8                         CFragSymbolClass
  205.  
  206.  
  207. kCodeCFragSymbol                EQU        0
  208. kDataCFragSymbol                EQU        1
  209. kTVectorCFragSymbol                EQU        2
  210. kTOCCFragSymbol                    EQU        3
  211. kGlueCFragSymbol                EQU        4
  212.     ENDIF
  213. ;
  214. ; ß
  215. ; ===========================================================================================
  216. ; System 7 Services (Deprecated in System 8)
  217. ; ==========================================
  218. ;
  219.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  220. ;
  221. ; ---------------------------------------------------------------------------------
  222. ; These declarations are for System 7 and the System 8 cooperative environment, but
  223. ; should be avoided under System 8.  Better alternatives exist for System 8.
  224. ;
  225. ;
  226. ; pascal OSErr GetSharedLibrary(ConstStr63Param libName, CFragArchitecture archType, CFragLoadOptions loadFlags, CFragConnectionID *connID, Ptr *mainAddr, Str255 errMessage)
  227. ;
  228.     IF ¨ GENERATINGCFM THEN
  229.         Macro
  230.         _GetSharedLibrary
  231.             move.w              #$0001,-(sp)
  232.             dc.w                $AA5A
  233.         EndM
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION GetSharedLibrary
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal OSErr GetDiskFragment(const FSSpec *fileSpec, UInt32 offset, UInt32 length, ConstStr63Param fragName, CFragLoadOptions loadFlags, CFragConnectionID *connID, Ptr *mainAddr, Str255 errMessage)
  240. ;
  241.     IF ¨ GENERATINGCFM THEN
  242.         Macro
  243.         _GetDiskFragment
  244.             move.w              #$0002,-(sp)
  245.             dc.w                $AA5A
  246.         EndM
  247.     ELSE
  248.         IMPORT_CFM_FUNCTION GetDiskFragment
  249.     ENDIF
  250.  
  251. ;
  252. ; pascal OSErr GetMemFragment(void *memAddr, UInt32 length, ConstStr63Param fragName, CFragLoadOptions loadFlags, CFragConnectionID *connID, Ptr *mainAddr, Str255 errMessage)
  253. ;
  254.     IF ¨ GENERATINGCFM THEN
  255.         Macro
  256.         _GetMemFragment
  257.             move.w              #$0003,-(sp)
  258.             dc.w                $AA5A
  259.         EndM
  260.     ELSE
  261.         IMPORT_CFM_FUNCTION GetMemFragment
  262.     ENDIF
  263.  
  264. ;
  265. ; pascal OSErr CloseConnection(CFragConnectionID *connID)
  266. ;
  267.     IF ¨ GENERATINGCFM THEN
  268.         Macro
  269.         _CloseConnection
  270.             move.w              #$0004,-(sp)
  271.             dc.w                $AA5A
  272.         EndM
  273.     ELSE
  274.         IMPORT_CFM_FUNCTION CloseConnection
  275.     ENDIF
  276.  
  277. ;
  278. ; pascal OSErr FindSymbol(CFragConnectionID connID, ConstStr255Param symName, Ptr *symAddr, CFragSymbolClass *symClass)
  279. ;
  280.     IF ¨ GENERATINGCFM THEN
  281.         Macro
  282.         _FindSymbol
  283.             move.w              #$0005,-(sp)
  284.             dc.w                $AA5A
  285.         EndM
  286.     ELSE
  287.         IMPORT_CFM_FUNCTION FindSymbol
  288.     ENDIF
  289.  
  290. ;
  291. ; pascal OSErr CountSymbols(CFragConnectionID connID, long *symCount)
  292. ;
  293.     IF ¨ GENERATINGCFM THEN
  294.         Macro
  295.         _CountSymbols
  296.             move.w              #$0006,-(sp)
  297.             dc.w                $AA5A
  298.         EndM
  299.     ELSE
  300.         IMPORT_CFM_FUNCTION CountSymbols
  301.     ENDIF
  302.  
  303. ;
  304. ; pascal OSErr GetIndSymbol(CFragConnectionID connID, long symIndex, Str255 symName, Ptr *symAddr, CFragSymbolClass *symClass)
  305. ;
  306.     IF ¨ GENERATINGCFM THEN
  307.         Macro
  308.         _GetIndSymbol
  309.             move.w              #$0007,-(sp)
  310.             dc.w                $AA5A
  311.         EndM
  312.     ELSE
  313.         IMPORT_CFM_FUNCTION GetIndSymbol
  314.     ENDIF
  315.  
  316.     ENDIF
  317. ;
  318. ; ß
  319. ; ===========================================================================================
  320. ; System 8 Services (Not available in System 7)
  321. ; =============================================
  322. ;
  323.     IF FOR_SYSTEM8_PREEMPTIVE THEN
  324. ;
  325. ; ---------------------------------------------------------------------------------
  326. ; These declarations are for all System 8 execution environments, but not System 7.
  327. ;
  328.  
  329. kPatchCFragUpdateLevel            EQU        255
  330.  
  331. kByteStreamCFragLocator            EQU        3
  332. kNamedFragmentCFragLocator        EQU        4
  333.  
  334. kNamedLibraryCFragLocator        EQU        4                    ; !!! Remove in D12!
  335.  
  336. kPrivilegedCFragMask            EQU        $0010                ; ! May be removed in the future!
  337. kResidentCFragMask                EQU        $0020                ; ! May be removed in the future!
  338. kTreatCFragAsLibraryMask        EQU        $0040                ; Used in GetXyzFragment to recognize by name too.
  339.  
  340. kPrivilegedCFragFlag            EQU        $0010                ; !!! Remove in D12!
  341. kResidentCFragFlag                EQU        $0020                ; !!! Remove in D12!
  342.  
  343. kMainCFragSymbolIndex            EQU        -1
  344. kInitCFragSymbolIndex            EQU        -2
  345. kTermCFragSymbolIndex            EQU        -3
  346. CFragRegisteredFileInfo    RECORD 0
  347. fileRef                     ds.l    1                ; offset: $0 (0)
  348. fileType                 ds.l    1                ; offset: $4 (4)
  349. nestingDepth             ds.l    1                ; offset: $8 (8)
  350. sizeof                     EQU *                    ; size:   $C (12)
  351.                         ENDR
  352.  
  353. kCFragRegisteredFileInfoVersion    EQU        $00010001
  354. ; typedef UInt8                         CFragCompatibility
  355.  
  356.  
  357. CFragBothCompatible                EQU        0
  358. CFragClientTooOld                EQU        1
  359. CFragProviderTooOld                EQU        2
  360. ; typedef UInt32                         CFragShortVersionPair
  361.  
  362. ;
  363. ; extern CFragCompatibility CFragCheckCompatibility(UInt32 clientPreferredVersion, UInt32 clientOldImpVersion, UInt32 providerCurrentVersion, UInt32 providerOldDefVersion)
  364. ;
  365.     IF GENERATINGCFM THEN
  366.         IMPORT_CFM_FUNCTION CFragCheckCompatibility
  367.     ENDIF
  368.  
  369. ;
  370. ; extern CFragCompatibility CFragCheckShortCompatibility(UInt32 clientVersions, UInt32 providerVersions)
  371. ;
  372.     IF GENERATINGCFM THEN
  373.         IMPORT_CFM_FUNCTION CFragCheckShortCompatibility
  374.     ENDIF
  375.  
  376. ;
  377. ; extern Boolean CFragHasFileLocation(CFragLocatorKind where)
  378. ;
  379.     IF GENERATINGCFM THEN
  380.         IMPORT_CFM_FUNCTION CFragHasFileLocation
  381.     ENDIF
  382.  
  383. ;
  384. ; extern Boolean CFragHasUnresolvedImports(CFragConnectionID connID)
  385. ;
  386.     IF GENERATINGCFM THEN
  387.         IMPORT_CFM_FUNCTION CFragHasUnresolvedImports
  388.     ENDIF
  389.  
  390. ;
  391. ; extern OSStatus CFragPrepareNamedFragment(ConstStr63Param fragName, CFragUsage usage, CFragArchitecture archType, CFragVersionNumber preferredVersion, CFragVersionNumber oldestVersion, CFragLoadOptions loadFlags, CFragConnectionID *connID, LogicalAddress *mainAddr, TextObject optErrMsg)
  392. ;
  393.     IF GENERATINGCFM THEN
  394.         IMPORT_CFM_FUNCTION CFragPrepareNamedFragment
  395.     ENDIF
  396.  
  397. ;
  398. ; extern OSStatus CFragPrepareFromDiskFork(FSObjectRef fileSpec, FSForkType forkTag, ItemCount forkInstance, ByteCount offset, ByteCount length, ConstStr63Param fragName, CFragLoadOptions loadFlags, CFragConnectionID *connID, LogicalAddress *mainAddr, TextObject optErrMsg)
  399. ;
  400.     IF GENERATINGCFM THEN
  401.         IMPORT_CFM_FUNCTION CFragPrepareFromDiskFork
  402.     ENDIF
  403.  
  404. ;
  405. ; extern OSStatus CFragPrepareFromMemory(LogicalAddress fragAddr, ByteCount length, ConstStr63Param fragName, CFragLoadOptions loadFlags, CFragConnectionID *connID, LogicalAddress *mainAddr, TextObject optErrMsg)
  406. ;
  407.     IF GENERATINGCFM THEN
  408.         IMPORT_CFM_FUNCTION CFragPrepareFromMemory
  409.     ENDIF
  410.  
  411. ;
  412. ; extern OSStatus CFragCloseConnection(CFragConnectionID *connID)
  413. ;
  414.     IF GENERATINGCFM THEN
  415.         IMPORT_CFM_FUNCTION CFragCloseConnection
  416.     ENDIF
  417.  
  418. ;
  419. ; extern OSStatus CFragFindNamedSymbol(CFragConnectionID connID, ConstStr255Param symName, LogicalAddress *symAddr, CFragSymbolClass *symClass)
  420. ;
  421.     IF GENERATINGCFM THEN
  422.         IMPORT_CFM_FUNCTION CFragFindNamedSymbol
  423.     ENDIF
  424.  
  425. ;
  426. ; extern OSStatus CFragCountSymbols(CFragConnectionID connID, ItemCount *symCount)
  427. ;
  428.     IF GENERATINGCFM THEN
  429.         IMPORT_CFM_FUNCTION CFragCountSymbols
  430.     ENDIF
  431.  
  432. ;
  433. ; extern OSStatus CFragGetIndexedSymbol(CFragConnectionID connID, SInt32 symIndex, Str255 symName, LogicalAddress *symAddr, CFragSymbolClass *symClass)
  434. ;
  435.     IF GENERATINGCFM THEN
  436.         IMPORT_CFM_FUNCTION CFragGetIndexedSymbol
  437.     ENDIF
  438.  
  439. ;
  440. ; extern OSStatus CFragGetFileSpec(CFragConnectionID connectionID, FSObjectRef *fileSpec)
  441. ;
  442.     IF GENERATINGCFM THEN
  443.         IMPORT_CFM_FUNCTION CFragGetFileSpec
  444.     ENDIF
  445.  
  446. ;
  447. ; extern OSStatus CFragGetFragmentName(CFragConnectionID connectionID, Str63 name)
  448. ;
  449.     IF GENERATINGCFM THEN
  450.         IMPORT_CFM_FUNCTION CFragGetFragmentName
  451.     ENDIF
  452.  
  453. ;
  454. ; extern OSStatus CFragRegisterFileFragments(KernelProcessID processID, FSObjectRef fileSpec, OSType fileType, ItemCount nestingDepth)
  455. ;
  456.     IF GENERATINGCFM THEN
  457.         IMPORT_CFM_FUNCTION CFragRegisterFileFragments
  458.     ENDIF
  459.  
  460. ;
  461. ; extern OSStatus CFragUnregisterFileFragments(KernelProcessID processID, FSObjectRef fileSpec, OSType fileType, ItemCount nestingDepth)
  462. ;
  463.     IF GENERATINGCFM THEN
  464.         IMPORT_CFM_FUNCTION CFragUnregisterFileFragments
  465.     ENDIF
  466.  
  467. ;
  468. ; extern OSStatus CFragGetRegisteredFiles(KernelProcessID processID, ItemCount requestedCount, ItemCount *totalCount, PBVersion infoVersion, CFragRegisteredFileInfo *registeredFiles)
  469. ;
  470.     IF GENERATINGCFM THEN
  471.         IMPORT_CFM_FUNCTION CFragGetRegisteredFiles
  472.     ENDIF
  473.  
  474.     ENDIF
  475. ;
  476. ; ß
  477. ; ===========================================================================================
  478. ; Initialization & Termination Routines
  479. ; =====================================
  480. ; -----------------------------------------------------------------------------------------
  481. ; A fragment's initialization and termination routines are called when a new incarnation of
  482. ; the fragment is created or destroyed, respectively.  Exactly when this occurs depends on
  483. ; what kinds of section sharing the fragment has and how the fragment is prepared.  Import
  484. ; libraries have at most one incarnation per process.  Fragments prepared with option
  485. ; kPrivateCFragCopy may have many incarnations per process.
  486. ; The initialization function is passed a pointer to an initialization information structure
  487. ; and returns an OSErr.  If an initialization function returns a non-zero value the entire
  488. ; closure of which it is a part fails.  The CFragInitBlock type has different visible parts
  489. ; under System 7 and System 8, but is of course the same internally.  The C prototype for an
  490. ; initialization function is:
  491. ;        pascal OSErr    CFragInitFunction    ( const CFragInitBlock *    initBlock );
  492. ; The termination procedure takes no parameters and returns nothing.  The C prototype for a
  493. ; termination procedure is:
  494. ;        pascal void        CFragTermProcedure    ( void );
  495. ;
  496.     IF FOR_OPAQUE_SYSTEM_DATA_STRUCTURES THEN
  497. ;
  498. ; --------------------------------------------------------------------------------------
  499. ; These declarations are the preferred form for System 8, hiding implementation details.
  500. ;
  501. CFragOpaqueInitBlock    RECORD 0
  502. processID                 ds.l    1                ; offset: $0 (0)
  503. closureID                 ds.l    1                ; offset: $4 (4)
  504. connectionID             ds.l    1                ; offset: $8 (8)
  505. reservedA                 ds.l    8                ; offset: $C (12)
  506. sizeof                     EQU *                    ; size:   $2C (44)
  507.                         ENDR
  508. ; typedef struct CFragOpaqueInitBlock *    CFragOpaqueInitBlockPtr
  509.  
  510. CFragInitBlock            RECORD 0
  511. f                         ds        CFragOpaqueInitBlock
  512. sizeof                     EQU *                    ; size:   $2C (44)
  513.                         ENDR
  514.  
  515.  
  516. ; typedef CFragOpaqueInitBlockPtr         CFragInitBlockPtr
  517.  
  518.     ELSE
  519. ;
  520. ; --------------------------------------------------------------------------------------
  521. ; These declarations are for System 7.  They may be used in System 8 but expose details.
  522. ;
  523. CFragSystem7MemoryLocator RECORD 0
  524. address                     ds.l    1                ; offset: $0 (0)
  525. length                     ds.l    1                ; offset: $4 (4)
  526. inPlace                     ds.b    1                ; offset: $8 (8)
  527. reservedA                 ds.b    1                ; offset: $9 (9)        ;  ! Must be zero!
  528. reservedB                 ds.w    1                ; offset: $A (10)        ;  ! Must be zero!
  529. sizeof                     EQU *                    ; size:   $C (12)
  530.                         ENDR
  531. CFragSystem7DiskFlatLocator RECORD 0
  532. fileSpec                 ds.l    1                ; offset: $0 (0)
  533. offset                     ds.l    1                ; offset: $4 (4)
  534. length                     ds.l    1                ; offset: $8 (8)
  535. sizeof                     EQU *                    ; size:   $C (12)
  536.                         ENDR
  537. ;  ! This must have a file specification at the same offset as a disk flat locator!
  538. CFragSystem7SegmentedLocator RECORD 0
  539. fileSpec                 ds.l    1                ; offset: $0 (0)
  540. rsrcType                 ds.l    1                ; offset: $4 (4)
  541. rsrcID                     ds.w    1                ; offset: $8 (8)
  542. reservedA                 ds.w    1                ; offset: $A (10)        ;  ! Must be zero!
  543. sizeof                     EQU *                    ; size:   $C (12)
  544.                         ENDR
  545. CFragSystem7Locator        RECORD 0
  546. where                     ds.l    1                ; offset: $0 (0)
  547. onDisk                     ds        CFragSystem7DiskFlatLocator ; offset: $4 (4)
  548.                          ORG 4
  549. inMem                     ds        CFragSystem7MemoryLocator ; offset: $4 (4)
  550.                          ORG 4
  551. inSegs                     ds        CFragSystem7SegmentedLocator ; offset: $4 (4)
  552. sizeof                     EQU *                    ; size:   $10 (16)
  553.                         ENDR
  554. ; typedef struct CFragSystem7Locator *    CFragSystem7LocatorPtr
  555.  
  556. CFragSystem7InitBlock    RECORD 0
  557. contextID                 ds.l    1                ; offset: $0 (0)
  558. closureID                 ds.l    1                ; offset: $4 (4)
  559. connectionID             ds.l    1                ; offset: $8 (8)
  560. fragLocator                 ds        CFragSystem7Locator ; offset: $C (12)
  561. libName                     ds.l    1                ; offset: $1C (28)
  562. reservedA                 ds.l    1                ; offset: $20 (32)        ;  ! Must be zero!
  563. sizeof                     EQU *                    ; size:   $24 (36)
  564.                         ENDR
  565. ; typedef struct CFragSystem7InitBlock * CFragSystem7InitBlockPtr
  566.  
  567. CFragInitBlock            RECORD 0
  568. f                         ds        CFragSystem7InitBlock
  569. sizeof                     EQU *                    ; size:   $24 (36)
  570.                         ENDR
  571.  
  572.  
  573. ; typedef CFragSystem7InitBlockPtr         CFragInitBlockPtr
  574.  
  575.     ENDIF
  576. ;
  577. ; ß
  578. ; ===========================================================================================
  579. ; Old Name Spellings
  580. ; ==================
  581. ; -------------------------------------------------------------------------------------------
  582. ; We've tried to reduce the risk of name collisions in the future by introducing the phrase
  583. ; "CFrag" into constant and type names.  The old names are defined below in terms of the new.
  584. ;
  585.     IF OLDROUTINENAMES THEN
  586. ; typedef CFragConnectionID             ConnectionID
  587.  
  588. ; typedef CFragLoadOptions                 LoadFlags
  589.  
  590. ; typedef CFragSymbolClass                 SymClass
  591.  
  592. InitBlock                RECORD 0
  593. f                         ds        CFragInitBlock
  594. sizeof                     EQU *                    ; size:   $2C (44)
  595.                         ENDR
  596.  
  597.  
  598. ; typedef CFragInitBlockPtr             InitBlockPtr
  599.  
  600.     IF ¨ FOR_OPAQUE_SYSTEM_DATA_STRUCTURES THEN
  601. MemFragment                RECORD 0
  602. f                         ds        CFragSystem7MemoryLocator
  603. sizeof                     EQU *                    ; size:   $C (12)
  604.                         ENDR
  605.  
  606.  
  607. DiskFragment            RECORD 0
  608. f                         ds        CFragSystem7DiskFlatLocator
  609. sizeof                     EQU *                    ; size:   $C (12)
  610.                         ENDR
  611.  
  612.  
  613. SegmentedFragment        RECORD 0
  614. f                         ds        CFragSystem7SegmentedLocator
  615. sizeof                     EQU *                    ; size:   $C (12)
  616.                         ENDR
  617.  
  618.  
  619. FragmentLocator            RECORD 0
  620. f                         ds        CFragSystem7Locator
  621. sizeof                     EQU *                    ; size:   $10 (16)
  622.                         ENDR
  623.  
  624.  
  625. ; typedef CFragSystem7LocatorPtr         FragmentLocatorPtr
  626.  
  627. CFragHFSMemoryLocator    RECORD 0
  628. f                         ds        CFragSystem7MemoryLocator
  629. sizeof                     EQU *                    ; size:   $C (12)
  630.                         ENDR
  631.  
  632.  
  633. CFragHFSDiskFlatLocator    RECORD 0
  634. f                         ds        CFragSystem7DiskFlatLocator
  635. sizeof                     EQU *                    ; size:   $C (12)
  636.                         ENDR
  637.  
  638.  
  639. CFragHFSSegmentedLocator RECORD 0
  640. f                         ds        CFragSystem7SegmentedLocator
  641. sizeof                     EQU *                    ; size:   $C (12)
  642.                         ENDR
  643.  
  644.  
  645. CFragHFSLocator            RECORD 0
  646. f                         ds        CFragSystem7Locator
  647. sizeof                     EQU *                    ; size:   $10 (16)
  648.                         ENDR
  649.  
  650.  
  651. ; typedef CFragSystem7LocatorPtr         CFragHFSLocatorPtr
  652.  
  653.     ENDIF
  654.  
  655. kPowerPCArch                    EQU        'pwpc'
  656. kMotorola68KArch                EQU        'm68k'
  657. kAnyArchType                    EQU        $3F3F3F3F
  658. kNoLibName                        EQU        0
  659. kNoConnectionID                    EQU        0
  660. kLoadLib                        EQU        $0001
  661. kFindLib                        EQU        $0002
  662. kNewCFragCopy                    EQU        $0005
  663. kLoadNewCopy                    EQU        $0005
  664. kUseInPlace                        EQU        $80
  665. kCodeSym                        EQU        0
  666. kDataSym                        EQU        1
  667. kTVectSym                        EQU        2
  668. kTOCSym                            EQU        3
  669. kGlueSym                        EQU        4
  670. kInMem                            EQU        0
  671. kOnDiskFlat                        EQU        1
  672. kOnDiskSegmented                EQU        2
  673. kIsLib                            EQU        0
  674. kIsApp                            EQU        1
  675. kIsDropIn                        EQU        2
  676. kFullLib                        EQU        0
  677. kUpdateLib                        EQU        1
  678. kWholeFork                        EQU        0
  679. kCFMRsrcType                    EQU        'cfrg'
  680. kCFMRsrcID                        EQU        0
  681. kSHLBFileType                    EQU        'shlb'
  682. kUnresolvedSymbolAddress        EQU        0
  683.  
  684. kPowerPC                        EQU        'pwpc'
  685. kMotorola68K                    EQU        'm68k'
  686.     ENDIF
  687.     ENDIF ; __CODEFRAGMENTS__ 
  688.  
  689.